using Cysharp.Threading.Tasks;
using TEngine;
using UnityEngine;
using YooAsset;
using ProcedureOwner = TEngine.IFsm<TEngine.IProcedureManager>;


public class ResourceProcedure : TEngine.ProcedureBase
{
    protected override void OnInit(ProcedureOwner procedureOwner)
    {
    }
    protected override void OnEnter(ProcedureOwner procedureOwner)
    {
        ResourceInit().Forget();
    }
    protected override void OnUpdate(ProcedureOwner procedureOwner, float elapseSeconds, float realElapseSeconds)
    {
    }
    async UniTask ResourceInit()
    {
        var initializationOperation = await GameModule.Resource.InitPackage();
        GameObject Cube = GameModule.Resource.LoadAsset<GameObject>("Cube");
        GameObject.Instantiate(Cube).transform.position = new Vector3(-2, 1, 0);
        GameObject Cylinder = await GameModule.Resource.LoadAssetAsync<GameObject>("Cylinder");
        GameObject.Instantiate(Cylinder).transform.position = new Vector3(0, 1, 0);

        GameObject Sphere= await GameModule.Resource.LoadGameObjectAsync("Sphere");
        Sphere.transform.position = new Vector3(2, 1, 0);
    }
}

